|
|
|
|
|
|
|
In many cases, compiling to native code can provide substantial gains in speed over the interpreted versions of the same application; however, this isn't always the case. You can follow some general guidelines to determine whether native code compilation is the correct method is use: |
|
|
|
|
|
|
|
|
Any code that does a lot of primitive operations, such as complex financial calculations or fractal generation, benefits from native code. |
|
|
|
|
|
|
|
|
Local process-intensive applications that shuffle a lot of data around within local data structures gain by using native code. |
|
|
|
|
|
|
|
|
Applications doing a lot of Windows API calls, COM method calls, and string manipulations don't benefit from using native code. |
|
|
|
|
|
|
|
|
Applications that consist mostly of functions from the Visual Basic for Applications runtime library don't see much, if any, advantage from using native code |
|
|
|
|
|
|
|
|
If your code involves a lot of subroutine calls, it also will unlikely appear to be much faster using native code. |
|
|
|
|
|
|
|
|
What native code does is allow programmers to write code procedures never possible before because of performance issues. Enabling these procedures to run much faster can also improve the responsiveness of certain portions of an application, which improves the perceived performance of the overall application. |
|
|
|
|
|
|
|
|
Finally, if you choose to compile your application to native code, you can use the available compiler options to optimize that type of executable file that will be created. Figures 19.4 and 19.5 show the compiler options that appear on the Compile page of the Project Properties dialog box and the advanced properties available when you click the Advanced Optimizations button. |
|
|
|
|
|
|
|
|
Figure 19.4.
Setting the compiler options for a
native-code-compiled application. |
|
|
|
|
|